<meta charset="UTF-8"> 
<script type="text/javascript">
	$(function(){
		//查询
		$('#student_searchbtn').click(function(){
			$('#student_user').datagrid('load', serializeForm($('#student_form').form()));
		});
		//清除查询
		$('#student_clearbtn').click(function(){
			$('#student_form').form('clear');
			$("#student_user").datagrid('load', {id: $('#student_id').val()});
		});
	})
</script>

<!-- <form class="layui-form" id = "student_form" method="post">
	<div class="layui-input-inline">
		<input type="text" name="username" placeholder="请输入用户名" class="layui-input">
	</div>
	<div class="layui-input-inline">
		<input type="text" name="name" placeholder="请输入姓名" class="layui-input">
	</div>
	<div class="layui-input-inline">
		<input type="text" name="phone" placeholder="请输入电话" class="layui-input">
	</div>
 	<div class="layui-btn-group">
	  	<button type="button" id = "student_searchbtn" class="layui-btn layui-btn-normal"><i class="layui-icon">&#xe615;</i>查询</button>
	  	<button type="button" id = "student_clearbtn" class="layui-btn layui-btn-warm"><i class="layui-icon">&#xe640;</i>清空</button>
	</div>
</form> -->

<table class="easyui-datagrid" data-data-options="|
	idField: 'id',
	title: '学生列表',
	fitColumns: true,
	width: '100%',
	striped: true,
	fit: true,
	loadMsg: '数据正在加载中...',
	rownumbers: true,
	url: 'student/list',
	queryParams: {id: ${id} },
	singleSelect: true,
	sortName: 'id',
	sortOrder: 'asc',
	pagination: true,
	pageSize: 10,
	pageList: [5, 10, 15, 20, 25, 50],
	dialog:{
		create:{
			title: '学生添加',
			width: 430,
			height: 330,
			action: 'student/save',
			href : 'student/edit'
		},
		update:{
			title: '学生修改',
			width: 430,
			height: 330,
			action: 'student/save',
			href : 'student/edit'
		},
		delete:{
			url: 'student/delete'
		},
		reset:{
			url: 'student/reset'
		}
	},
	toolbar: [$.crudgrid.buttons.create,'-',$.crudgrid.buttons.update,'-',$.crudgrid.buttons.delete,'-',$.crudgrid.buttons.reset,'-',$.crudgrid.buttons.reload,'-']
|">
	<thead>
		<tr>
			<th data-options="field: 'id', title: 'ID',	width: 100, align: 'center', sortable:true"></th>
			<th data-options="field: 'username', title: '用户名', width: 200, align: 'center'"></th>
			<th data-options="field: 'name', title: '姓名', width: 200, align: 'center'"></th>
			<th data-options="field: 'phone', title: '电话', width: 200, align: 'center'"></th>
			<th data-options="field: 'sex', title: '性别', width: 100, align: 'center'"></th>
			<th data-options="field: 'number', title: '借书数量', width: 150, align: 'center'"></th>
			<th data-options="field: 'dept', title: '班级', 	width: 200,	align: 'center',
						formatter: function(value){  
							return value.name;
						}"
			></th>
		</tr>
	</thead>
</table>
